package com.zhoushihao.class0806;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class PhoneNubmer {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String phone = sc.nextLine();
        int[] number = new int[10];
        for (int i = 0; i < phone.length(); i++) {
            number[phone.charAt(i) - '0']++;
        }
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < number.length; i++) {
            if (number[i] > 0) {
                list.add(i);
            }
        }
        list.sort((a, b) -> b - a);
        int[] index = new int[phone.length()];
        for (int i = 0; i < phone.length(); i++) {
            index[i] = list.indexOf(phone.charAt(i) - '0');
        }
        String arr = Arrays.toString(list.toArray()).substring(1, Arrays.toString(list.toArray()).length() - 1).replaceAll(" ","");
        String indexArr = Arrays.toString(index).substring(1, Arrays.toString(index).length() - 1).replaceAll(" ","");
        System.out.println("int[] arr = new int[]{" + arr + "};");
        System.out.println("int[] index = new int[]{" + indexArr + "};");
    }
}
